package com.cao.project.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cao.common.core.domain.model.LoginUser;
import com.cao.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cao.project.mapper.TaskCommentMapper;
import com.cao.project.domain.TaskComment;
import com.cao.project.service.ITaskCommentService;

/**
 * 任务评论：存储任务的评论信息Service业务层处理
 *
 * @author cao
 * @date 2025-03-03
 */
@Service
public class TaskCommentServiceImpl extends ServiceImpl<TaskCommentMapper, TaskComment> implements ITaskCommentService {
    /**
     * 查询任务评论：存储任务的评论信息列表
     *
     * @param taskComment 任务评论：存储任务的评论信息
     * @return 任务评论：存储任务的评论信息
     */
    @Override
    public List<TaskComment> selectTaskCommentList(TaskComment taskComment) {
        return baseMapper.selectTaskCommentList(taskComment);
    }

    @Override
    public int add(TaskComment taskComment) {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        taskComment.setUserId(loginUser.getUserId());
        taskComment.setUserName(loginUser.getUsername());
        return baseMapper.insert(taskComment);
    }
}
